package com.lv.dhart.ui.fragment.fghome.inner.jjholdcount;

import android.content.Context;
import android.view.View;

import com.lv.dhart.R;
import com.lv.dhart.beans.JJHoldeBeans;
import com.smart.holder.iinterface.IViewHolder;
import com.smart.holder.iinterface.IViewHolderHelper;

import java.util.List;

/**
 * Created by binny on 2018/6/1.
 * 历史上的今天
 */

public class JJHoldCountViewHolderHelper implements IViewHolderHelper<JJHoldCountViewHolder, JJHoldeBeans.DataDTO> {


    @Override
    public IViewHolder initItemViewHolder(JJHoldCountViewHolder viewHolder, View convertView) {
        viewHolder = new JJHoldCountViewHolder();
        viewHolder.stock_name = convertView.findViewById(R.id.stock_name);
        viewHolder.jj_count = convertView.findViewById(R.id.jj_count);
        viewHolder.mArticleCardView = convertView.findViewById(R.id.article_card_view);
        return viewHolder;
    }

    @Override
    public void bindListDataToView(Context context, List<JJHoldeBeans.DataDTO> list, JJHoldCountViewHolder viewHolder, int i) {
//        if (i == 0) {
//            viewHolder.mArticleCardView.setBackground(context.getResources().getDrawable(R.drawable.article_card_view_shape_current_day));
//        } else if (i == 1) {
//            viewHolder.mArticleCardView.setBackground(context.getResources().getDrawable(R.drawable.article_card_view_shape_blue));
//        } else {
//            viewHolder.mArticleCardView.setBackground(context.getResources().getDrawable(R.drawable.article_card_view_shape_green01));
//
//        }
        viewHolder.mArticleCardView.setBackground(context.getResources().getDrawable(R.drawable.article_card_view_shape_current_day));
        viewHolder.stock_name.setText(list.get(i).getHolderName());
        viewHolder.jj_count.setText(String.valueOf(list.get(i).getNum()));
    }

}
